package org.example.controller;

import org.apache.dubbo.config.annotation.DubboReference;
import org.example.dto.Stock;
import org.example.dubbo.StockProviderService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class DubboConsumerController {

    @DubboReference
    private StockProviderService stockProviderService;

    @GetMapping("/get/stock")
    public Stock getStock(@RequestParam("skuId") Long skuId){
        return stockProviderService.getStock(skuId);
    }
}
